package com.common.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cxh.dao.A_auctionMsgDao;
import com.cxh.dao.A_goodsDao;
import com.cxh.dao.impl.A_auctionMsgDaoImpl;
import com.cxh.dao.impl.A_goodsDaoImpl;
import com.lyk.dao.A_transferDao;
import com.lyk.dao.impl.A_transferDaoImpl;
import com.zjg.dao.OpinionDao;
import com.zjg.dao.impl.OpinionDaoImpl;

public class HomeServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse resp)
			throws ServletException, IOException {
		List<Integer> list = new ArrayList<Integer>();
		A_transferDao transferDao = new A_transferDaoImpl();
		Integer transferSum = transferDao.sumPoundage();
		OpinionDao opinion = new OpinionDaoImpl();
		Integer opinionSum = opinion.CountOpinion();
		A_goodsDao goodsDao = new A_goodsDaoImpl();
		Integer goodsSum = goodsDao.countGoods();
		A_auctionMsgDao auctionMsgDao = new A_auctionMsgDaoImpl();
		Integer auctionMsgSum = auctionMsgDao.countAuctionMsg();
		list.add(transferSum);
		list.add(opinionSum);
		list.add(goodsSum);
		list.add(auctionMsgSum);
		request.setAttribute("list", list);
		request.getRequestDispatcher("home.jsp").forward(request, resp);
	}
	
}
